package com.boss.mappeer;

import com.boss.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {


    // 根据用户名查询用户
    @Select("select * from users where username = #{username}")
    User findByUsername(String username);

    // 添加用户
    @Select("insert into users(username,password,role,name,email,phone,create_time,update_time) values(#{userName},#{password},#{role},#{name},#{email},#{phone},now(),now())")
    void  add(String userName, String password, String name, int role, String email, String phone);

    // 根据用户名和密码查询用户
    @Select("select * from users where username = #{userName} and password = #{password}")
    User getByUserNameAndPassword(User user);
}
